package ch.fhnw.qualiscan.core;

import ch.fhnw.qualiscan.ApplicationData;
import ch.fhnw.qualiscan.core.helpers.UserSessionHelper;
import ch.fhnw.qualiscan.core.helpers.TextHelper;
import ch.fhnw.qualiscan.core.libraries.ComponentLibrary;
import ch.fhnw.qualiscan.core.libraries.LoaderLibrary;
import ch.fhnw.qualiscan.core.libraries.ModalLibrary;

import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

import eu.livotov.tpt.TPTApplication;

/**
* Abstract class for all components. All components need to inherit from this class.
* @author Kevin Mettenberger, Benjamin Groehbiel
*
*/

@SuppressWarnings("serial")
public abstract class LayoutComponent extends VerticalLayout {
	
	public TextHelper textHelper;
	public UserSessionHelper sessionHelper;
	public ComponentLibrary componentLib;
	public ApplicationData appData;
	public LoaderLibrary loaderLib;
	public ModalLibrary modalLib;
	
	/**
	 * Constructor; loading all necessary functions for the concrete component.
	 */
	public LayoutComponent() {
		setStyleName("component");
		setSpacing(true);
		textHelper = new TextHelper();
		sessionHelper = new UserSessionHelper();
		componentLib = new ComponentLibrary();
		appData = (ApplicationData) TPTApplication.getCurrentApplication().getMainWindow().getData();
		
		loaderLib = appData.getLoaderLib();
		modalLib = new ModalLibrary();
		
		buildComponent();
	}

	
	/**
	 * Layout implementation with ui elements.
	 */
	public abstract void buildComponent();
	
}
